package com.example.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.example.demo.entity.User;



@Repository
public interface User_Mapper extends Basic_Mapper<User> {
	
	@Select("select * from User ${where} ${limit}")
	public List<User> select(@Param("where")String where,@Param("limit") String limit);
	
	@Select("select * from User where name=#{name} and password=#{password}")
	public List<User> login(User u);
	@Delete("delete from user where id=#{id}")
	public void delete(int id);
	
	@Insert("insert into user(name,password,status,power) values(#{name},#{password},#{status},#{power})")
	public void insert(User t);
	
	@Update("update user set name=#{name},password=#{password},status=#{status},power=#{power} where id=#{id}")
	public void update(User t);
	
	@Select("select * from user where id=#{id}")
	public User getById(int id);
}
